package cn.mldn.microcloud.receiver;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

import cn.mldn.microcloud.service.MySink;
import cn.mldn.microcloud.service.MySource;

@Component
@EnableBinding(MySink.class)
public class StreamReceiver {

	//@RabbitListener(queuesToDeclare = @Queue("myQueue"))
	//自动创建队列，Exchange与queue绑定
	
	//根据队列接收消息
	@StreamListener(target = MySink.INPUT,value="")
	@SendTo(MySource.OUTPUT2)
	public String Process(String message){
		System.out.println("StreamReceiver message:"+message);
		return "recevid";
	}
	
	@StreamListener(MySink.INPUT2)
	public void Process2(String message){
		System.out.println("StreamReceiver INPUT2 message:"+message);
	}
}
